package com.seth.myapplication;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.seth.myapplication.helper.SetStatusTabHeight;
import com.seth.myapplication.login.LoginPage;

public class LoginActivity extends FragmentActivity {

    private LinearLayout topStatus;


    private static Fragment contentFragment;

    private FragmentManager fm;

    public static void setContentFragment(Fragment fragment) {
        contentFragment = fragment;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

        setContentView(R.layout.activity_login);

        initView();
        initEvent();

        fm = getSupportFragmentManager();

        contentFragment = fm.findFragmentById(R.id.activity_login);

        if(contentFragment == null){
            contentFragment = new LoginPage();
            fm.beginTransaction().add(R.id.activity_login, contentFragment).commit();

        }

    }

    private void initEvent() {
        new SetStatusTabHeight(topStatus,this).setRelativeLayout();
    }

    private void initView() {
        topStatus = (LinearLayout) findViewById(R.id.login_top_sts);

    }


}
